package com.demo;

/**
 * Created by Administrator on 2018/9/19.
 */
public class Hero {
    private String name;
    private Weapon weapon;

    public Hero() {
    }

    public Hero(String name, Weapon weapon) {
        this.name = name;
        this.weapon = weapon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    @Inject
    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }

    public void fight() {
        System.out.println(name + "开始攻击了！");
        weapon.attack();
    }
}
